package com.eksisozluk.eksidroid.remote.fetcher;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import com.eksisozluk.eksidroid.common.util.Constants;
import com.eksisozluk.eksidroid.remote.service.RemoteRequestExecuter;

public class ContentFetcher
{
	private RemoteRequestExecuter	requestExecuter;

	public ContentFetcher(RemoteRequestExecuter requestExecuter)
	{
		this.requestExecuter = requestExecuter;
	}
	
	public String getIndexPageContent()
	{
		String requestUrl = Constants.URL_REMOTE_INDEX_PAGE_REQUEST;
		
		List<NameValuePair> parameters = new ArrayList<NameValuePair>();
		
		String content = requestExecuter.execute(requestUrl, parameters);
		
		return content;
	}
	
	public String getPageContent(String title)
	{
		String requestUrl = Constants.URL_REMOTE_PAGE_REQUEST;
		
		List<NameValuePair> parameters = new ArrayList<NameValuePair>();
		parameters.add(new BasicNameValuePair(Constants.PARAM_REMOTE_PAGE_TITLE, title));
		
		String content = requestExecuter.execute(requestUrl, parameters);
		
		return content;
	}

}
